package com.lam.system.entity;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.lam.common.base.domain.BaseEntity;
import com.lam.common.components.dict.annotation.Dict;
import com.lam.common.components.easyexcel.converter.DictConverter;
import com.lam.common.utils.DateUtil;
import com.lam.common.validate.annotation.DictCheck;
import com.lam.common.validate.annotation.DictValid;
import com.lam.common.validate.group.Add;

/**
 * 用户信息对象 sys_user
 * 
 * @author admin
 * @date 2022-09-20
 */
@DictCheck
@ColumnWidth(30)
@TableName("sys_user")
public class SysUser implements BaseEntity{

    /** 主键 */
    @ExcelIgnore
    @Null(groups = Add.class, message="id必须为空")
    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    
    /** 登录账号 */
    @ExcelProperty("登录账号")
    @NotBlank(message = "登录账号不能为空", groups = {Add.class})
    @Size(max = 100, message = "登录账号长度不能超过100个字符", groups = {Add.class})
    private String username;
    
    /** 注册登录方式（1-手机号，2-邮箱，3-账号密码） */
    @NotNull(message = "注册登录方式不能为空")
    @DictValid(message = "无效的注册登录方式")
    @Dict(dictCode = "reg_type")
    private Integer regType;

    /** 真实姓名 */
    @ExcelProperty("真实姓名")
    @NotBlank(message = "真实姓名不能为空")
    @Size(max = 100, message = "真实姓名长度不能超过100个字符")
    private String realname;

    /** 昵称 */
    @ExcelProperty("昵称")
    @NotBlank(message = "昵称不能为空")
    @Size(max = 100, message = "昵称长度不能超过100个字符")
    private String nickName;

    /** 密码 */
    @ExcelIgnore
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;

    /** md5密码盐 */
    @ExcelIgnore
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String salt;

    /** 头像 */
    @ExcelIgnore
    private String avatar;

    /** 性别(0-未知,1-男,2-女) */
    @ExcelProperty(value = "性别", converter = DictConverter.class)
    @NotNull(message = "性别不能为空")
    @DictValid(message = "无效的性别")
    @Dict(dictCode = "sex")
    private Integer sex;

    /** 邮箱 */
    @ExcelProperty("邮箱")
    @Size(max = 45, message = "邮箱长度不能超过45个字符")
    private String email;

    /** 电话 */
    @ExcelProperty("电话")
    @Size(max = 45, message = "电话长度不能超过45个字符")
    private String phone;

    /** 状态(1-正常,2-禁用) */
    @ExcelProperty(value = "状态", converter = DictConverter.class)
    @NotNull(message = "状态不能为空")
    @DictValid(message = "无效的状态")
    @Dict(dictCode = "user_status")
    private Integer status;

    /** 工号 */
    @ExcelIgnore
    @Size(max = 100, message = "工号长度不能超过100个字符")
    private String workNo;

    /** 职务 */
    @ExcelIgnore
    @Size(max = 100, message = "职务长度不能超过100个字符")
    private String post;
    
    /** 组织机构 */
    @ExcelIgnore
    @TableField(exist = false)
    private String deptId;

    /** 用户类型(1前端，2后端，3前端和后端，0禁止登陆) */
    @ExcelProperty(value = "用户类型", converter = DictConverter.class)
    @NotNull(message = "用户类型不能为空")
    @Dict(dictCode = "user_type")
    private Integer userType;

    /** 是否新用户(1是，0否) */
    @ExcelProperty(value = "是否新用户", converter = DictConverter.class)
    @Dict(dictCode = "yn10")
    private Integer isNew;

    /** 创建人 */
    @ExcelProperty("创建人")
    private String createBy;

    /** 创建时间 */
    @ExcelProperty("创建时间")
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /** 更新人 */
    @ExcelProperty("更新人")
    private String updateBy;

    /** 更新时间 */
    @ExcelProperty("更新时间")
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    /** 备注 */
    @ExcelProperty("备注")
    @Size(max = 255, message = "备注长度不能超过255个字符")
    private String remark;


    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    } 

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUsername() {
        return username;
    }    
    
    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getRealname() {
        return realname;
    }    
    
    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getNickName() {
        return nickName;
    }    
    
    public void setPassword(String password) {
        this.password = password;
    }

    public String getPassword() {
        return password;
    }    
    
    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getSalt() {
        return salt;
    }    
    
    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getAvatar() {
        return avatar;
    }    
    
    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Integer getSex() {
        return sex;
    }    
    
    public void setEmail(String email) {
        this.email = email;
    }

    public String getEmail() {
        return email;
    }    
    
    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPhone() {
        return phone;
    }    
    
    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }    
    
    public void setWorkNo(String workNo) {
        this.workNo = workNo;
    }

    public String getWorkNo() {
        return workNo;
    }    
    
    public void setPost(String post) {
        this.post = post;
    }

    public String getPost() {
        return post;
    }    
    
    public void setUserType(Integer userType) {
        this.userType = userType;
    }

    public Integer getUserType() {
        return userType;
    }    
    
    public void setIsNew(Integer isNew) {
        this.isNew = isNew;
    }

    public Integer getIsNew() {
        return isNew;
    }    
    
    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getCreateBy() {
        return createBy;
    }    
    
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getCreateTime() {
        return createTime;
    }    
    
    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public String getUpdateBy() {
        return updateBy;
    }    
    
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }    
    
    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getRemark() {
        return remark;
    }

	public String getDeptId() {
		return deptId;
	}

	public void setDeptId(String deptId) {
		this.deptId = deptId;
	}

	public Integer getRegType() {
		return regType;
	}

	public void setRegType(Integer regType) {
		this.regType = regType;
	}    
    

}
